#include<iostream>
#include<cstdio>
#include<unistd.h>
#include<signal.h>

void Cont(int seconds){
    while (seconds){
        printf("%2d\r",seconds--);
        fflush(stdout);
        sleep(1);
    }
    
}

void handler(int signo){
    Cont(20);
}

int main(int argc,char* argv[]){
    signal(SIGINT,handler);
    signal(SIGQUIT,handler);
    while(true){
        std::cout<<getpid()<<std::endl;
        sleep(1);
    }
    return 0;
}
